# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=urlcrazy
pkgver=v0.8.2.r0.g78bf6e8
pkgrel=1
epoch=1
groups=('blackarch' 'blackarch-webapp')
pkgdesc='Generate and test domain typos and variations to detect and perform typo squatting, URL hijacking, phishing, and corporate espionage.'
arch=('any')
url='http://www.morningstarsecurity.com/research/urlcrazy'
license=('custom')
depends=('ruby' 'ruby-bundler')
makedepends=('git')
source=("git+https://github.com/urbanadventurer/$pkgname.git")
sha256sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" *.md

  rm -rf *.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec bundle exec ruby $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

